package mysql

import "gorm.io/gorm"

type Member struct {
	gorm.Model
	Title   string  `gorm:"type:varchar(255);not null;"`
	Price   float64 `gorm:"type:float(10,2);not null;"`
	OrderSn string  `gorm:"type:varchar(255);not null;"`
	Types   string  `gorm:"type:varchar(255);not null;"`
	UserId  int     `gorm:"type:int(10);not null;"`
}

type User struct {
	Username string `gorm:"type:varchar(255);not null;"`
}

func (m *Member) Create() error {
	return db.Create(&m).Error
}
func (u *User) ListUser(username string) error {
	return db.Where("username = ?", username).First(&u).Error
}

func (m *Member) ListMember(types string) error {
	return db.Where("types = ?", types).First(&m).Error
}
